package com.hrg.seer.sdk.rbk.api;

import lombok.Getter;

import static com.hrg.seer.sdk.rbk.api.MiscApiEnum.ROBOT_OTHER_SETDO_REQ;

@Getter
public enum DIOOperationType {

	LoadBySetDOAndWaitDI(ROBOT_OTHER_SETDO_REQ, "设置 DO load, 等待DI 确认", "loadDIO", "SetDO", "WaitDI"),
	UnloadBySetDOAndWaitDI(ROBOT_OTHER_SETDO_REQ, "设置 DO unload, 等待DI 确认", "unloadDIO", "SetDO", "WaitDI"),
	;
	private final MiscApiEnum apiEnum;
	private final String chin;
	private final String operation;
	private final String setDOOperationFull;
	private final String waitDIOperationFull;

	DIOOperationType(MiscApiEnum apiEnum, String chin, String operation, String setDOOperationFull, String waitDIOperationFull) {
		this.apiEnum = apiEnum;
		this.chin = chin;
		this.operation = operation;
		this.setDOOperationFull = setDOOperationFull;
		this.waitDIOperationFull = waitDIOperationFull;
	}

	public static DIOOperationType getByOperation(String operation) {
		for (DIOOperationType type : DIOOperationType.values()) {
			if (type.getOperation().equalsIgnoreCase(operation)) {
				return type;
			}
		}
		return null;
	}

	public boolean isLoad() {
		return operation.toLowerCase().contains("load");
	}

	public boolean isUnload() {
		return operation.toLowerCase().contains("unload");
	}
}
